media: solo6x10: replace max(a, min(b, c)) by clamp(b, a, c)
authorAurelien Jarno <aurelien@aurel32.net>
Sat, 13 Jan 2024 18:33:31 +0000 (19:33 +0100)
committerSalvatore Bonaccorso <carnil@debian.org>
Mon, 26 Aug 2024 19:47:39 +0000 (21:47 +0200)
commit7e66353956f2b7c1faac9e3ca99f6cae945310b6
tree6d4c301efadab01357662301bf40d3f0c4d7fac9
parentc9bd5b302a5b7f97342c374e7d4f3a4ffdef3b46
media: solo6x10: replace max(a, min(b, c)) by clamp(b, a, c)

Origin: https://git.kernel.org/linus/31e97d7c9ae3de072d7b424b2cf706a03ec10720

This patch replaces max(a, min(b, c)) by clamp(b, a, c) in the solo6x10
driver.  This improves the readability and more importantly, for the
solo6x10-p2m.c file, this reduces on my system (x86-64, gcc 13):

 - the preprocessed size from 121 MiB to 4.5 MiB;

 - the build CPU time from 46.8 s to 1.6 s;

 - the build memory from 2786 MiB to 98MiB.

In fine, this allows this relatively simple C file to be built on a
32-bit system.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Closes: https://lore.kernel.org/lkml/18c6df0d-45ed-450c-9eda-95160a2bbb8e@gmail.com/
Cc: <stable@vger.kernel.org> # v6.7+
Suggested-by: David Laight <David.Laight@ACULAB.COM>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: David Laight <David.Laight@ACULAB.COM>
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name media-solo6x10-replace-max-a-min-b-c-by-clamp-b-a-c.patch
drivers/media/pci/solo6x10/solo6x10-offsets.h